package com.atguigu.ssyx.acl.controller;

import com.atguigu.ssyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author suchengchen
 * @date 2023/8/17
 * @description
 */
@Api(tags = "登陆接口")
@RestController
@RequestMapping("admin/acl/index")
//@CrossOrigin
public class IndexController {

    /**
     * 登陆
     *
     * @return
     */
    @ApiOperation("登陆")
    @PostMapping("/login")
    public Result login() {
        //返回token
        Map<String, String> map = new HashMap<>();
        map.put("token", "admin-token");
        return Result.ok(map);
    }

    /**
     * 2 获取用户信息
     */
    @ApiOperation("获取用户信息")
    @GetMapping("/info")
    public Result info() {
        HashMap<Object, Object> map = new HashMap<>();
        map.put("name", "atguigu");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * 登出
     */
    @ApiOperation("登出")
    @PostMapping("/logout")
    public Result logout() {
        //返回token
        return Result.ok(null);
    }
}
